function getUserForGroupPanel(allwidth){
	var dataRecord = Ext.data.Record.create([
			{name : 'groupid',	type : 'string'},
			{name : 'groupcode',	type : 'string'},
			{name : 'groupname',	type : 'string'},
			{name : 'groupdescription',	type : 'string'}
			]);
	
			var store = new Ext.data.Store({
			 proxy : new Ext.data.HttpProxy({
						url : basepath+'../sysControl/permission/UserController/queryUserGroup.do?isSelect=true'

						}),

				reader : new Ext.data.JsonReader({
							id : 'groupid'
						}, dataRecord)
			});
			var store2 = new Ext.data.Store({
			 proxy : new Ext.data.HttpProxy({
						url : basepath+'../sysControl/permission/UserController/queryUserGroup.do?isSelect=false'
						}),

				reader : new Ext.data.JsonReader({
							id : 'groupid'
						}, dataRecord)
			});
	
var grid = new Ext.grid.GridPanel({
	border: false,
		title:"已选择的用户组",
		ddGroup   : 'firstGridDDGroup',
		sm:new Ext.grid.RowSelectionModel(),
		columns:[
			{id : 'groupcode',header : '组编号',dataIndex : 'groupcode',	width : 100,sortable : true},
			{id : 'groupname',header : '组名称',dataIndex : 'groupname',	width : 116,sortable : true},
			{id : 'groupdescription',header : '组描述',dataIndex : 'groupdescription',	width : 130,sortable : true}],
	    width: allwidth/2-20,
		store : store,
		enableDragDrop   : true,
        stripeRows       : true,
	   region            : 'west'
	});
var grid2 = new Ext.grid.GridPanel({
	border: false,
		title:"未选择的用户组",
		ddGroup : 'secondGridDDGroup',
		sm:new Ext.grid.RowSelectionModel(),
		columns:[
			{id : 'groupcode',header : '组编号',dataIndex : 'groupcode',	width : 100,sortable : true},
			{id : 'groupname',header : '组名称',dataIndex : 'groupname',	width : 116,sortable : true} ,
			{id : 'groupdescription',header : '组描述',dataIndex : 'groupdescription',	width : 130,sortable : true}],
		store : store2,
	    width: allwidth/2-20,
		enableDragDrop   : true,
        stripeRows       : true,
	   region            : 'east'
	});
	
	
	
	 function addRow(firstGrid,secondGrid){
					var records = secondGrid.getSelectionModel().getSelections();
					if(records&&records.length>0){
					
						  var store= secondGrid.getStore();
						  var red=firstGrid.getSelectionModel().getSelected();
						  var index1=firstGrid.getStore().getCount();
						  if(red)
						  index1=firstGrid.getStore(index1).indexOf(red)+1;
						  var index=store.indexOf(records[0])-1;
                          index=index<0?0:index;
                          store.remove(records);
						  firstGrid.getStore().insert(index1,records);
					
					 secondGrid.getSelectionModel().selectRow(index);

					}
		 
		 
	 }
	   function move(grid,moveZ){
					var record = grid.getSelectionModel().getSelected();
					if(record){
                   var store= grid.getStore();
                    var index=store.indexOf(record);
					var indexZ=index+moveZ;
					if(indexZ>=0&&indexZ<store.getCount()){
						store.remove(record);
						store.insert(indexZ,record);
						grid.getSelectionModel().selectRow(indexZ);
						
					}
                    }
		 
		 
	 }
	grid2.on("render",function(){
		var firstGridDropTargetEl =  grid2.getView().el.dom.childNodes[0].childNodes[1];
		var firstGridDropTarget = new Ext.dd.DropTarget(firstGridDropTargetEl, {
			ddGroup    : 'firstGridDDGroup',
			copy       : false,
			notifyDrop : function(ddSource, e, data){
				function addRow(record, index, allItems) {
				
						store.remove(record);
						store2.add(record);
				}
				Ext.each(ddSource.dragData.selections ,addRow);
				return(true);
			}
		});
	});
	grid.on("render",function(){
		var secondGridDropTargetEl = grid.getView().el.dom.childNodes[0].childNodes[1]
	
		
		var destGridDropTarget = new Ext.dd.DropTarget(secondGridDropTargetEl, {
			ddGroup    : 'secondGridDDGroup',
			copy       : false,
			notifyDrop : function(ddSource, e, data){
				function addRow(record, index, allItems) {
							if(record.get('systempretag')==2){
								Ext.Msg.alert('提示',record.get('columnname')+'为固定项,必须存在');
							return ;
							}
						store2.remove(record);
						store.add(record);
				}
				Ext.each(ddSource.dragData.selections ,addRow);
				return(true);
			}
		});
	});
var displayPanel = new Ext.Panel({
		layout   : 'border',
		region : 'south',
		width: allwidth,
		border: true,
		height:200,
		items    : [
			grid, {
                xtype: 'panel',
				style : 'text-align:center;',
                region: 'center',
				padding : "60px 0px 0px 0px",
				frame: true,
				items:[{xtype:'button',icon: basepath+"/image/right2.gif",handler:function(){addRow(grid2,grid);}},
						{xtype:'button',icon: basepath+"/image/left2.gif",handler:function(){addRow(grid,grid2);}},
						//{xtype:'button',icon: basepath+"/image/up2.gif",handler:function(){move(grid2,-1);}},
						//{xtype:'button',icon: basepath+"/image/down2.gif",handler:function(){move(grid2,1);}}
						{xtype:'button',iconCls : 'table_row_insert',handler:function(){var rsAll=store2.getRange(0,store2.getCount());store2.removeAll();store.add(rsAll);}},
						{xtype:'button'	,iconCls : 'table_row_delete',handler:function(){var rsAll=store.getRange(0,store.getCount());store.removeAll();store2.add(rsAll);}}
						]
				
            },
			grid2
		]});
		var myresize=function() {
					grid.setWidth(displayPanel.getInnerWidth() /2-20);
					grid2.setWidth(displayPanel.getInnerWidth() /2-20);
				}
	displayPanel.on("resize", myresize);
	 displayPanel.on("destroy", function() {displayPanel.un("resize",myresize);});
		return displayPanel;
}